import json
from src.common.logger import getLogger
from flask import Blueprint, request, Response
from src.modules.agent.service import AgenticService

logger = getLogger()
api = Blueprint("agentic", __name__)

@api.route("/agentic/invoke", methods = ["POST"])
def invoke_agent():
    args = request.form
    logger.info(f"invoke_agent args: {args}")
    response = AgenticService.invoke_agent(args)
    return Response(json.dumps({ "code": 200, "data": response }), status = 200, mimetype = "application/json")
